package com.itheima.day17;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class AnnoDemo {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
        //获取了useTest的字节码文件对象
        Class<?> aClass = Class.forName("com.itheima.day17.UseTest");
        //创建对象
        Object o = aClass.newInstance();

        Method[] declaredMethods = aClass.getDeclaredMethods();

        for (Method declaredMethod : declaredMethods) {
            if (declaredMethod.isAnnotationPresent(Test.class)){
                    declaredMethod.invoke(o);
            }
        }
    }
}
